/*
 * This class is a test class for singleton.
 * 
 * public:
 * 	public static void main();
 */

package client;

import javax.swing.JFrame;

import singleton.President;
import java.awt.GridLayout;
import javax.swing.JLabel;

public class SingletonClient extends JFrame{
	/**
	 * 
	 */
	private static final long serialVersionUID = 6409034402220998389L;

	public SingletonClient() {
		getContentPane().setLayout(new GridLayout(6, 0, 0, 0));
		
		President obma = President.getInstance("obma");
		President cld = President.getInstance("cld");
		President hehe = President.getInstance("hehe");
		
		JLabel lbl1 = new JLabel("President obma = President.getInstance(\"obma\")");
		getContentPane().add(lbl1);
		
		JLabel lbl2 = new JLabel("President cld = President.getInstance(\"cld\");");
		getContentPane().add(lbl2);
		
		JLabel lbl3 = new JLabel("President hehe = President.getInstance(\"hehe\");");
		getContentPane().add(lbl3);
		
		JLabel lbl4 = new JLabel("President obma's name is:"+obma.getName());
		getContentPane().add(lbl4);
		
		JLabel lbl5 = new JLabel("President cld's name is:"+cld.getName());
		getContentPane().add(lbl5);
		
		JLabel lbl6 = new JLabel("President hehe's name is:"+hehe.getName());
		getContentPane().add(lbl6);
		
		//get objects name
				System.out.println(obma.getName());
				System.out.println(cld.getName());
				System.out.println(hehe.getName());
	}

	public static void main(String[] args) {
		
		SingletonClient view = new SingletonClient();
		view.setBounds(200, 200, 400, 400);
		view.setVisible(true);
	}

		
	
}
